diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-01-02 17:57:40 +0100 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-01-02 17:57:40 +0100 |
commit | 1cde40b45916d1f99a4cda7837b516cde761f127 (patch) | |
tree | e74367db95dd4e9200783c78df2b3d811d834ead /web/pw-server/src/routes/matches/[match_id].svelte | |
parent | 69331eb08a6199bfa8378e08cf378803b076eaae (diff) | |
download | planetwars.dev-1cde40b45916d1f99a4cda7837b516cde761f127.tar.xz planetwars.dev-1cde40b45916d1f99a4cda7837b516cde761f127.zip |
basic match views
Diffstat (limited to 'web/pw-server/src/routes/matches/[match_id].svelte')
-rw-r--r-- | web/pw-server/src/routes/matches/[match_id].svelte | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/web/pw-server/src/routes/matches/[match_id].svelte b/web/pw-server/src/routes/matches/[match_id].svelte new file mode 100644 index 0000000..3fe98f8 --- /dev/null +++ b/web/pw-server/src/routes/matches/[match_id].svelte @@ -0,0 +1,31 @@ +<script lang="ts" context="module"> + export async function load({ page }) { + const res = await fetch(`/api/matches/${page.params["match_id"]}`, { + headers: { + "Content-Type": "application/json", + }, + }); + + if (res.ok) { + return { + props: { + matchLog: await res.text(), + }, + }; + } + + return { + status: res.status, + error: new Error("failed to load match"), + }; + } +</script> + +<script lang="ts"> + import Visualizer from "$lib/components/Visualizer.svelte"; + export let matchLog: string; +</script> + +<div> + <Visualizer {matchLog} /> +</div> |